<?php
class Sfs_Filesystem_Upload
{
	/**
	 *  storing  uploaded file in data path
	 * @param string $file_name
	 * @param  string $path
	 */
	public function getStorePath($path='')
	{
		if ($path == '') {
			$data_path = Bootstrap::getPath('data').'/'.$this->_request->getModuleName();
			if (!is_dir($data_path))
			mkdir($data_path,0755);
		}
		else { // 自訂目錄
			$arr = explode ("/",$path);
			$temp = Bootstrap::getPath('data').'/';
			for($i=0;$i<count($arr);$i++){
				if ($arr[$i]<>''){
					$temp .= $arr[$i];
					if (!is_dir($temp))
					mkdir($temp, 0755);
					$temp .= "/";
				}
			}
			$data_path = $temp;
		}
		return $data_path;
	}

}